package com.minelx.statementsplus;

import java.util.List;
import java.util.Objects;

public class CombinedSql {

	private final List<String> children;

	private final MajorSql major;

	public CombinedSql(MajorSql major, List<String> children) {
		this.children = children;
		this.major = major;
	}

	public MajorSql major() {
		return major;
	}

	public List<String> children() {
		return children;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;
		CombinedSql that = (CombinedSql) o;
		return children.equals(that.children) && major().equals(that.major());
	}

	@Override
	public int hashCode() {
		return Objects.hash(children, major());
	}

	@Override
	public String toString() {
		return "CombinedSql{" +
				"children=" + children +
				", major=" + major().head() +
				'}';
	}
}
